<?php


/**
 * Base class that represents a query for the 'gebruiker' table.
 *
 * 
 *
 * @method     GebruikerQuery orderByGebruikerid($order = Criteria::ASC) Order by the gebruikerID column
 * @method     GebruikerQuery orderByEmail($order = Criteria::ASC) Order by the email column
 * @method     GebruikerQuery orderByWachtwoord($order = Criteria::ASC) Order by the wachtwoord column
 * @method     GebruikerQuery orderByRekeningnummer($order = Criteria::ASC) Order by the rekeningnummer column
 * @method     GebruikerQuery orderByRank($order = Criteria::ASC) Order by the rank column
 *
 * @method     GebruikerQuery groupByGebruikerid() Group by the gebruikerID column
 * @method     GebruikerQuery groupByEmail() Group by the email column
 * @method     GebruikerQuery groupByWachtwoord() Group by the wachtwoord column
 * @method     GebruikerQuery groupByRekeningnummer() Group by the rekeningnummer column
 * @method     GebruikerQuery groupByRank() Group by the rank column
 *
 * @method     GebruikerQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
 * @method     GebruikerQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
 * @method     GebruikerQuery innerJoin($relation) Adds a INNER JOIN clause to the query
 *
 * @method     GebruikerQuery leftJoinKoppelGebruikerPoul($relationAlias = null) Adds a LEFT JOIN clause to the query using the KoppelGebruikerPoul relation
 * @method     GebruikerQuery rightJoinKoppelGebruikerPoul($relationAlias = null) Adds a RIGHT JOIN clause to the query using the KoppelGebruikerPoul relation
 * @method     GebruikerQuery innerJoinKoppelGebruikerPoul($relationAlias = null) Adds a INNER JOIN clause to the query using the KoppelGebruikerPoul relation
 *
 * @method     GebruikerQuery leftJoinPoul($relationAlias = null) Adds a LEFT JOIN clause to the query using the Poul relation
 * @method     GebruikerQuery rightJoinPoul($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Poul relation
 * @method     GebruikerQuery innerJoinPoul($relationAlias = null) Adds a INNER JOIN clause to the query using the Poul relation
 *
 * @method     GebruikerQuery leftJoinPunten($relationAlias = null) Adds a LEFT JOIN clause to the query using the Punten relation
 * @method     GebruikerQuery rightJoinPunten($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Punten relation
 * @method     GebruikerQuery innerJoinPunten($relationAlias = null) Adds a INNER JOIN clause to the query using the Punten relation
 *
 * @method     GebruikerQuery leftJoinVoorspelling($relationAlias = null) Adds a LEFT JOIN clause to the query using the Voorspelling relation
 * @method     GebruikerQuery rightJoinVoorspelling($relationAlias = null) Adds a RIGHT JOIN clause to the query using the Voorspelling relation
 * @method     GebruikerQuery innerJoinVoorspelling($relationAlias = null) Adds a INNER JOIN clause to the query using the Voorspelling relation
 *
 * @method     Gebruiker findOne(PropelPDO $con = null) Return the first Gebruiker matching the query
 * @method     Gebruiker findOneOrCreate(PropelPDO $con = null) Return the first Gebruiker matching the query, or a new Gebruiker object populated from the query conditions when no match is found
 *
 * @method     Gebruiker findOneByGebruikerid(int $gebruikerID) Return the first Gebruiker filtered by the gebruikerID column
 * @method     Gebruiker findOneByEmail(string $email) Return the first Gebruiker filtered by the email column
 * @method     Gebruiker findOneByWachtwoord(string $wachtwoord) Return the first Gebruiker filtered by the wachtwoord column
 * @method     Gebruiker findOneByRekeningnummer(string $rekeningnummer) Return the first Gebruiker filtered by the rekeningnummer column
 * @method     Gebruiker findOneByRank(int $rank) Return the first Gebruiker filtered by the rank column
 *
 * @method     array findByGebruikerid(int $gebruikerID) Return Gebruiker objects filtered by the gebruikerID column
 * @method     array findByEmail(string $email) Return Gebruiker objects filtered by the email column
 * @method     array findByWachtwoord(string $wachtwoord) Return Gebruiker objects filtered by the wachtwoord column
 * @method     array findByRekeningnummer(string $rekeningnummer) Return Gebruiker objects filtered by the rekeningnummer column
 * @method     array findByRank(int $rank) Return Gebruiker objects filtered by the rank column
 *
 * @package    propel.generator.database.om
 */
abstract class BaseGebruikerQuery extends ModelCriteria
{

	/**
	 * Initializes internal state of BaseGebruikerQuery object.
	 *
	 * @param     string $dbName The dabase name
	 * @param     string $modelName The phpName of a model, e.g. 'Book'
	 * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
	 */
	public function __construct($dbName = 'database', $modelName = 'Gebruiker', $modelAlias = null)
	{
		parent::__construct($dbName, $modelName, $modelAlias);
	}

	/**
	 * Returns a new GebruikerQuery object.
	 *
	 * @param     string $modelAlias The alias of a model in the query
	 * @param     Criteria $criteria Optional Criteria to build the query from
	 *
	 * @return    GebruikerQuery
	 */
	public static function create($modelAlias = null, $criteria = null)
	{
		if ($criteria instanceof GebruikerQuery) {
			return $criteria;
		}
		$query = new GebruikerQuery();
		if (null !== $modelAlias) {
			$query->setModelAlias($modelAlias);
		}
		if ($criteria instanceof Criteria) {
			$query->mergeWith($criteria);
		}
		return $query;
	}

	/**
	 * Find object by primary key
	 * Use instance pooling to avoid a database query if the object exists
	 * <code>
	 * $obj  = $c->findPk(12, $con);
	 * </code>
	 * @param     mixed $key Primary key to use for the query
	 * @param     PropelPDO $con an optional connection object
	 *
	 * @return    Gebruiker|array|mixed the result, formatted by the current formatter
	 */
	public function findPk($key, $con = null)
	{
		if ((null !== ($obj = GebruikerPeer::getInstanceFromPool((string) $key))) && $this->getFormatter()->isObjectFormatter()) {
			// the object is alredy in the instance pool
			return $obj;
		} else {
			// the object has not been requested yet, or the formatter is not an object formatter
			$criteria = $this->isKeepQuery() ? clone $this : $this;
			$stmt = $criteria
				->filterByPrimaryKey($key)
				->getSelectStatement($con);
			return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
		}
	}

	/**
	 * Find objects by primary key
	 * <code>
	 * $objs = $c->findPks(array(12, 56, 832), $con);
	 * </code>
	 * @param     array $keys Primary keys to use for the query
	 * @param     PropelPDO $con an optional connection object
	 *
	 * @return    PropelObjectCollection|array|mixed the list of results, formatted by the current formatter
	 */
	public function findPks($keys, $con = null)
	{	
		$criteria = $this->isKeepQuery() ? clone $this : $this;
		return $this
			->filterByPrimaryKeys($keys)
			->find($con);
	}

	/**
	 * Filter the query by primary key
	 *
	 * @param     mixed $key Primary key to use for the query
	 *
	 * @return    GebruikerQuery The current query, for fluid interface
	 */
	public function filterByPrimaryKey($key)
	{
		return $this->addUsingAlias(GebruikerPeer::GEBRUIKERID, $key, Criteria::EQUAL);
	}

	/**
	 * Filter the query by a list of primary keys
	 *
	 * @param     array $keys The list of primary key to use for the query
	 *
	 * @return    GebruikerQuery The current query, for fluid interface
	 */
	public function filterByPrimaryKeys($keys)
	{
		return $this->addUsingAlias(GebruikerPeer::GEBRUIKERID, $keys, Criteria::IN);
	}

	/**
	 * Filter the query on the gebruikerID column
	 * 
	 * @param     int|array $gebruikerid The value to use as filter.
	 *            Accepts an associative array('min' => $minValue, 'max' => $maxValue)
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    GebruikerQuery The current query, for fluid interface
	 */
	public function filterByGebruikerid($gebruikerid = null, $comparison = null)
	{
		if (is_array($gebruikerid) && null === $comparison) {
			$comparison = Criteria::IN;
		}
		return $this->addUsingAlias(GebruikerPeer::GEBRUIKERID, $gebruikerid, $comparison);
	}

	/**
	 * Filter the query on the email column
	 * 
	 * @param     string $email The value to use as filter.
	 *            Accepts wildcards (* and % trigger a LIKE)
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    GebruikerQuery The current query, for fluid interface
	 */
	public function filterByEmail($email = null, $comparison = null)
	{
		if (null === $comparison) {
			if (is_array($email)) {
				$comparison = Criteria::IN;
			} elseif (preg_match('/[\%\*]/', $email)) {
				$email = str_replace('*', '%', $email);
				$comparison = Criteria::LIKE;
			}
		}
		return $this->addUsingAlias(GebruikerPeer::EMAIL, $email, $comparison);
	}

	/**
	 * Filter the query on the wachtwoord column
	 * 
	 * @param     string $wachtwoord The value to use as filter.
	 *            Accepts wildcards (* and % trigger a LIKE)
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    GebruikerQuery The current query, for fluid interface
	 */
	public function filterByWachtwoord($wachtwoord = null, $comparison = null)
	{
		if (null === $comparison) {
			if (is_array($wachtwoord)) {
				$comparison = Criteria::IN;
			} elseif (preg_match('/[\%\*]/', $wachtwoord)) {
				$wachtwoord = str_replace('*', '%', $wachtwoord);
				$comparison = Criteria::LIKE;
			}
		}
		return $this->addUsingAlias(GebruikerPeer::WACHTWOORD, $wachtwoord, $comparison);
	}

	/**
	 * Filter the query on the rekeningnummer column
	 * 
	 * @param     string $rekeningnummer The value to use as filter.
	 *            Accepts wildcards (* and % trigger a LIKE)
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    GebruikerQuery The current query, for fluid interface
	 */
	public function filterByRekeningnummer($rekeningnummer = null, $comparison = null)
	{
		if (null === $comparison) {
			if (is_array($rekeningnummer)) {
				$comparison = Criteria::IN;
			} elseif (preg_match('/[\%\*]/', $rekeningnummer)) {
				$rekeningnummer = str_replace('*', '%', $rekeningnummer);
				$comparison = Criteria::LIKE;
			}
		}
		return $this->addUsingAlias(GebruikerPeer::REKENINGNUMMER, $rekeningnummer, $comparison);
	}

	/**
	 * Filter the query on the rank column
	 * 
	 * @param     int|array $rank The value to use as filter.
	 *            Accepts an associative array('min' => $minValue, 'max' => $maxValue)
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    GebruikerQuery The current query, for fluid interface
	 */
	public function filterByRank($rank = null, $comparison = null)
	{
		if (is_array($rank)) {
			$useMinMax = false;
			if (isset($rank['min'])) {
				$this->addUsingAlias(GebruikerPeer::RANK, $rank['min'], Criteria::GREATER_EQUAL);
				$useMinMax = true;
			}
			if (isset($rank['max'])) {
				$this->addUsingAlias(GebruikerPeer::RANK, $rank['max'], Criteria::LESS_EQUAL);
				$useMinMax = true;
			}
			if ($useMinMax) {
				return $this;
			}
			if (null === $comparison) {
				$comparison = Criteria::IN;
			}
		}
		return $this->addUsingAlias(GebruikerPeer::RANK, $rank, $comparison);
	}

	/**
	 * Filter the query by a related KoppelGebruikerPoul object
	 *
	 * @param     KoppelGebruikerPoul $koppelGebruikerPoul  the related object to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    GebruikerQuery The current query, for fluid interface
	 */
	public function filterByKoppelGebruikerPoul($koppelGebruikerPoul, $comparison = null)
	{
		return $this
			->addUsingAlias(GebruikerPeer::GEBRUIKERID, $koppelGebruikerPoul->getGebruiksid(), $comparison);
	}

	/**
	 * Adds a JOIN clause to the query using the KoppelGebruikerPoul relation
	 * 
	 * @param     string $relationAlias optional alias for the relation
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    GebruikerQuery The current query, for fluid interface
	 */
	public function joinKoppelGebruikerPoul($relationAlias = null, $joinType = Criteria::INNER_JOIN)
	{
		$tableMap = $this->getTableMap();
		$relationMap = $tableMap->getRelation('KoppelGebruikerPoul');
		
		// create a ModelJoin object for this join
		$join = new ModelJoin();
		$join->setJoinType($joinType);
		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
		if ($previousJoin = $this->getPreviousJoin()) {
			$join->setPreviousJoin($previousJoin);
		}
		
		// add the ModelJoin to the current object
		if($relationAlias) {
			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
			$this->addJoinObject($join, $relationAlias);
		} else {
			$this->addJoinObject($join, 'KoppelGebruikerPoul');
		}
		
		return $this;
	}

	/**
	 * Use the KoppelGebruikerPoul relation KoppelGebruikerPoul object
	 *
	 * @see       useQuery()
	 * 
	 * @param     string $relationAlias optional alias for the relation,
	 *                                   to be used as main alias in the secondary query
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    KoppelGebruikerPoulQuery A secondary query class using the current class as primary query
	 */
	public function useKoppelGebruikerPoulQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
	{
		return $this
			->joinKoppelGebruikerPoul($relationAlias, $joinType)
			->useQuery($relationAlias ? $relationAlias : 'KoppelGebruikerPoul', 'KoppelGebruikerPoulQuery');
	}

	/**
	 * Filter the query by a related Poul object
	 *
	 * @param     Poul $poul  the related object to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    GebruikerQuery The current query, for fluid interface
	 */
	public function filterByPoul($poul, $comparison = null)
	{
		return $this
			->addUsingAlias(GebruikerPeer::GEBRUIKERID, $poul->getPoulleider(), $comparison);
	}

	/**
	 * Adds a JOIN clause to the query using the Poul relation
	 * 
	 * @param     string $relationAlias optional alias for the relation
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    GebruikerQuery The current query, for fluid interface
	 */
	public function joinPoul($relationAlias = null, $joinType = Criteria::INNER_JOIN)
	{
		$tableMap = $this->getTableMap();
		$relationMap = $tableMap->getRelation('Poul');
		
		// create a ModelJoin object for this join
		$join = new ModelJoin();
		$join->setJoinType($joinType);
		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
		if ($previousJoin = $this->getPreviousJoin()) {
			$join->setPreviousJoin($previousJoin);
		}
		
		// add the ModelJoin to the current object
		if($relationAlias) {
			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
			$this->addJoinObject($join, $relationAlias);
		} else {
			$this->addJoinObject($join, 'Poul');
		}
		
		return $this;
	}

	/**
	 * Use the Poul relation Poul object
	 *
	 * @see       useQuery()
	 * 
	 * @param     string $relationAlias optional alias for the relation,
	 *                                   to be used as main alias in the secondary query
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    PoulQuery A secondary query class using the current class as primary query
	 */
	public function usePoulQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
	{
		return $this
			->joinPoul($relationAlias, $joinType)
			->useQuery($relationAlias ? $relationAlias : 'Poul', 'PoulQuery');
	}

	/**
	 * Filter the query by a related Punten object
	 *
	 * @param     Punten $punten  the related object to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    GebruikerQuery The current query, for fluid interface
	 */
	public function filterByPunten($punten, $comparison = null)
	{
		return $this
			->addUsingAlias(GebruikerPeer::GEBRUIKERID, $punten->getGebruikerid(), $comparison);
	}

	/**
	 * Adds a JOIN clause to the query using the Punten relation
	 * 
	 * @param     string $relationAlias optional alias for the relation
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    GebruikerQuery The current query, for fluid interface
	 */
	public function joinPunten($relationAlias = null, $joinType = Criteria::INNER_JOIN)
	{
		$tableMap = $this->getTableMap();
		$relationMap = $tableMap->getRelation('Punten');
		
		// create a ModelJoin object for this join
		$join = new ModelJoin();
		$join->setJoinType($joinType);
		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
		if ($previousJoin = $this->getPreviousJoin()) {
			$join->setPreviousJoin($previousJoin);
		}
		
		// add the ModelJoin to the current object
		if($relationAlias) {
			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
			$this->addJoinObject($join, $relationAlias);
		} else {
			$this->addJoinObject($join, 'Punten');
		}
		
		return $this;
	}

	/**
	 * Use the Punten relation Punten object
	 *
	 * @see       useQuery()
	 * 
	 * @param     string $relationAlias optional alias for the relation,
	 *                                   to be used as main alias in the secondary query
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    PuntenQuery A secondary query class using the current class as primary query
	 */
	public function usePuntenQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
	{
		return $this
			->joinPunten($relationAlias, $joinType)
			->useQuery($relationAlias ? $relationAlias : 'Punten', 'PuntenQuery');
	}

	/**
	 * Filter the query by a related Voorspelling object
	 *
	 * @param     Voorspelling $voorspelling  the related object to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    GebruikerQuery The current query, for fluid interface
	 */
	public function filterByVoorspelling($voorspelling, $comparison = null)
	{
		return $this
			->addUsingAlias(GebruikerPeer::GEBRUIKERID, $voorspelling->getGebruikerid(), $comparison);
	}

	/**
	 * Adds a JOIN clause to the query using the Voorspelling relation
	 * 
	 * @param     string $relationAlias optional alias for the relation
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    GebruikerQuery The current query, for fluid interface
	 */
	public function joinVoorspelling($relationAlias = null, $joinType = Criteria::INNER_JOIN)
	{
		$tableMap = $this->getTableMap();
		$relationMap = $tableMap->getRelation('Voorspelling');
		
		// create a ModelJoin object for this join
		$join = new ModelJoin();
		$join->setJoinType($joinType);
		$join->setRelationMap($relationMap, $this->useAliasInSQL ? $this->getModelAlias() : null, $relationAlias);
		if ($previousJoin = $this->getPreviousJoin()) {
			$join->setPreviousJoin($previousJoin);
		}
		
		// add the ModelJoin to the current object
		if($relationAlias) {
			$this->addAlias($relationAlias, $relationMap->getRightTable()->getName());
			$this->addJoinObject($join, $relationAlias);
		} else {
			$this->addJoinObject($join, 'Voorspelling');
		}
		
		return $this;
	}

	/**
	 * Use the Voorspelling relation Voorspelling object
	 *
	 * @see       useQuery()
	 * 
	 * @param     string $relationAlias optional alias for the relation,
	 *                                   to be used as main alias in the secondary query
	 * @param     string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
	 *
	 * @return    VoorspellingQuery A secondary query class using the current class as primary query
	 */
	public function useVoorspellingQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
	{
		return $this
			->joinVoorspelling($relationAlias, $joinType)
			->useQuery($relationAlias ? $relationAlias : 'Voorspelling', 'VoorspellingQuery');
	}

	/**
	 * Exclude object from result
	 *
	 * @param     Gebruiker $gebruiker Object to remove from the list of results
	 *
	 * @return    GebruikerQuery The current query, for fluid interface
	 */
	public function prune($gebruiker = null)
	{
		if ($gebruiker) {
			$this->addUsingAlias(GebruikerPeer::GEBRUIKERID, $gebruiker->getGebruikerid(), Criteria::NOT_EQUAL);
	  }
	  
		return $this;
	}

} // BaseGebruikerQuery
